//*******************************************************重写RadioGroup****************************************	    
				Ext.override(Ext.form.RadioGroup, {     
				    getValue: function(){     
				        var v;     
				        if (this.rendered) {     
				            this.items.each(function(item){     
				                if (!item.getValue())      
				                    return true;     
				                v = item.getRawValue();     
				                return false;     
				            });     
				        }     
				        else {     
				            for (var k in this.items) {     
				                if (this.items[k].checked) {     
				                    v = this.items[k].inputValue;     
				                    break;     
				                }     
				            }     
				        }
				        
				        return v;     
				    },     
				    setValue: function(v){     
				        if (this.rendered)      
				            this.items.each(function(item){     
				                item.setValue(item.getRawValue() == v);   
				            });     
				        else {     
				            for (var k in this.items) {     
				                this.items[k].checked = this.items[k].inputValue == v;     
				            }     
				        } 
				        
				    }     
				}); 

/** **************** 新增方法 ******************* */
				function add_column_fun(fparentBh, fparentName, tree_op) {

					    
					var column_form = new top.Ext.form.FormPanel(
							{
								frame : true,
								url : 'reportInfo!saveReportInfo.do',
								method : 'POST',
								labelWidth : 80,
								waitMsgTarget : true,
								items : [{
											fieldLabel : '当前操作',
											html : '在' + fparentName + '下新增节点'
										}, new top.Ext.form.RadioGroup({
						                       id:'type_radio_id',
											   style:'width:180px; display: block;text-align:left;line-height:22px;',
											   height:20,
						       				   fieldLabel : '节点类型',
						                       columns : 3,
						                       vertical :true,
						                       items:[
						                              {boxLabel:'栏目',inputValue:'1',name:'ftype',checked: true},
						                              {boxLabel:'栏目类别',inputValue:'2',name:'ftype'}],
										        listeners : {
										        	'change' : function(rg, checked){
										        		sqlContent.getEl().dom.readOnly = checked.getGroupValue() == 'yes' ? false : true;
												}}
									    }),
										{
											xtype : 'textfield',
											fieldLabel : '栏目编号',
											name : 'fbh',
											readOnly : false,
											allowBlank : true,
											emptyText : '',
											blankText : '',
											width : 200
										}, {
											xtype : 'textfield',
											fieldLabel : '栏目名称',
											name : 'fname',
											readOnly : false,
											allowBlank : true,
											emptyText : '',
											blankText : '',
											width : 200
										}, {
											xtype : 'textarea',
											fieldLabel : '备注',
											name : 'fdesc',
											readOnly : false,
											allowBlank : true,
											height : 40,
											width : 290
										}, {
											xtype : 'hidden',
											name : 'fflag',
											value : '3' //报表
										}, {
											xtype : 'hidden',
											name : 'fparent',
											value : fparentBh
										}]
							});

							
					var btn_sure_add_column = new top.Ext.Button({
						text : '确定',
						iconCls : 'sy-save',
						handler : function() {
						var frm = column_form.getForm();
							if (frm.isValid()) {
								frm.submit({
									waitTitle : '请稍候',
									waitMsg : '正在提交表单数据,请稍候...',
									success : function(form, action) {
										add_column_window.close();
										tree_op.root.reload();
										top.Ext.Msg.alert('', '保存成功！');
										
									},
									failure : function(form, action) {
										add_column_window.close();
										tree_op.root.reload();
										top.Ext.Msg.alert('', '保存失败！');
									},// failure
									icon : Ext.Msg.ERROR
								});
							};// isValid
						}
					});
					
					var btn_cancel_add_column = new top.Ext.Button({
						text : '取消',
						iconCls : 'sy-reset',
						handler : function() {
							add_column_window.close();
						}
					});
							
					var add_column_window = new top.Ext.Window(
							{
								width : 420,
								height : 270,
								layout : 'fit', 
								title : '新增栏目',
								iconCls : 'sy-win-flag',
								modal : true,
								tbar : [ btn_sure_add_column, '-', btn_cancel_add_column ],
								items : [ column_form ]
							});
					add_column_window.show();

				} // end fun()				
				
/** **************** 修改图表方法 ******************* */
				function mod_chart_fun(fbh, fname, tree_op) {

					var chart_form = new top.Ext.form.FormPanel(
							{
								frame : true,
								url : 'reportInfo!updateReportInfo.do',
								method : 'POST',
								labelWidth : 80,
								waitMsgTarget : true,
								items : [{
											fieldLabel : '当前操作',
											html : '修改图表' + fname 
										}, new top.Ext.form.RadioGroup({
						                       id:'ccgc_radio_id',
											   style:'width:100px; display: block;text-align:left;line-height:22px;',
											   height:20,
						       				   fieldLabel : '调用存储过程',
						                       columns : 3,
						                       vertical :true,
						                       items:[
						                              {boxLabel:'否',inputValue:'1',name:'fprocedure_open',checked: true},
						                              {boxLabel:'是',inputValue:'2',name:'fprocedure_open'}],
										        listeners : {
										        	'change' : function(rg, checked){
										        		sqlContent.getEl().dom.readOnly = checked.getGroupValue() == 'yes' ? false : true;
												}}
									    }), {
											xtype : 'textfield',
											fieldLabel : '存储过程名',
											name : 'fprocedure_name',
											readOnly : false,
											allowBlank : true,
											emptyText : '',
											blankText : '',
											width : 200
										}, {
											xtype : 'textfield',
											fieldLabel : '报表名称',
											name : 'fname',
											readOnly : false,
											allowBlank : true,
											emptyText : '',
											blankText : '',
											width : 200
										}, {
											xtype : 'textfield',
											fieldLabel : '报表附名',
											name : 'fname_next',
											readOnly : false,
											allowBlank : true,
											emptyText : '',
											blankText : '',
											width : 200
										}, new top.Ext.form.RadioGroup({
						                       id:'fx_radio_id',
											   style:'width:100px; display: block;text-align:left;line-height:22px;',
											   height:20,
						       				   fieldLabel : '显示分析结果',
						                       columns : 3,
						                       vertical :true,
						                       items:[
						                              {boxLabel:'否',inputValue:'1',name:'ffx_open',checked: true},
						                              {boxLabel:'是',inputValue:'2',name:'ffx_open'}],
										        listeners : {
										        	'change' : function(rg, checked){
										        		sqlContent.getEl().dom.readOnly = checked.getGroupValue() == 'yes' ? false : true;
												}}
									    }), {
											xtype : 'textfield',
											fieldLabel : '分析策略编号',
											name : 'ffx_bh',
											readOnly : false,
											allowBlank : true,
											emptyText : '',
											blankText : '',
											width : 200
										}, new top.Ext.form.RadioGroup({
						                       id:'ftable_radio_id',
											   style:'width:100px; display: block;text-align:left;line-height:22px;',
											   height:20,
						       				   fieldLabel : '显示关联报表',
						                       columns : 3,
						                       vertical :true,
						                       items:[
						                              {boxLabel:'否',inputValue:'1',name:'frela_open',checked: true},
						                              {boxLabel:'是',inputValue:'2',name:'frela_open'}],
										        listeners : {
										        	'change' : function(rg, checked){
										        		sqlContent.getEl().dom.readOnly = checked.getGroupValue() == 'yes' ? false : true;
												}}
									    }), {
											xtype : 'textfield',
											fieldLabel : '关联报表编号',
											name : 'frela_bh',
											readOnly : false,
											allowBlank : true,
											emptyText : '',
											blankText : '',
											width : 200
										}, new top.Ext.form.RadioGroup({
						                       id:'fshow_radio_id',
											   style:'width:100px; display: block;text-align:left;line-height:22px;',
											   height:20,
						       				   fieldLabel : '在首页显示',
						                       columns : 3,
						                       vertical :true,
						                       items:[
						                              {boxLabel:'否',inputValue:'1',name:'fshow',checked: true},
						                              {boxLabel:'是',inputValue:'2',name:'fshow'}],
										        listeners : {
										        	'change' : function(rg, checked){
										        		sqlContent.getEl().dom.readOnly = checked.getGroupValue() == 'yes' ? false : true;
												}}
									    }), {
											xtype : 'textarea',
											fieldLabel : '备注',
											name : 'fdesc',
											readOnly : false,
											allowBlank : true,
											height : 40,
											width : 290
										}, {
											xtype : 'hidden',
											name : 'fbh',
											value : fbh
										}]
							});

							
					var btn_sure_mod_chart = new top.Ext.Button({
						text : '确定',
						iconCls : 'sy-save',
						handler : function() {
						var frm = chart_form.getForm();
							if (frm.isValid()) {
								frm.submit({
									waitTitle : '请稍候',
									waitMsg : '正在提交表单数据,请稍候...',
									success : function(form, action) {
										mod_chart_window.close();
										tree_op.root.reload();
										top.Ext.Msg.alert('', '保存成功！');
										
									},
									failure : function(form, action) {
										mod_chart_window.close();
										tree_op.root.reload();
										top.Ext.Msg.alert('', '保存失败！');
									},// failure
									icon : Ext.Msg.ERROR
								});
							};// isValid
						}
					});
					
					var btn_cancel_mod_chart = new top.Ext.Button({
						text : '取消',
						iconCls : 'sy-reset',
						handler : function() {
							mod_chart_window.close();
						}
					});
							
					var mod_chart_window = new top.Ext.Window(
							{
								width : 420,
								height : 390,
								layout : 'fit', 
								title : '修改图表',
								iconCls : 'sy-win-flag',
								modal : true,
								tbar : [ btn_sure_mod_chart, '-', btn_cancel_mod_chart ],
								items : [ chart_form ]
							});
					mod_chart_window.show();

				} // end fun()
				
				
		/** **************** 选择更新模板 ******************* */
				function select_template_fun(fbh_report, fname_report, tree_op) {

					var Jthtwb_mould = top.Ext.data.Record.create([ {
						name : 'fid',
						mapping : 'fid',
						type : 'string'
					}, {
						name : 'fname',
						mapping : 'fname',
						type : 'string'
					}, {
						name : 'fdesc',
						mapping : 'fdesc',
						type : 'string'
					}, {
						name : 'fcdate',
						mapping : 'fcdate',
						type : 'string'
					}, {
						name : 'ftype',
						mapping : 'ftype',
						type : 'string'
					}, {
						name : 'fstate',
						mapping : 'fstate',
						type : 'string'
					}, {
						name : 'fbh',
						mapping : 'fbh',
						type : 'string'
					}]);
				
					var ds_mould = new top.Ext.data.Store({
						reader : new Ext.data.JsonReader({
							totalProperty : 'totalProperty',
							root : 'root'
						}, Jthtwb_mould),
						idProperty : 'threadid',
						remoteSort : true,
						url : 'mouldInfo!queryMouldInfo.do'
					});
				
					ds_mould.load({
						params : {
							start : 0,
							limit : 30
						}
					});
				
				
					//定义勾选框，不需要可不必定义
					var sm_mould = new top.Ext.grid.CheckboxSelectionModel({
						singleSelect : true
					});
				
					//定义列
					var colM_mould = new top.Ext.grid.ColumnModel([ sm_mould, new Ext.grid.RowNumberer(),//增加自动编号，不需要可不必定义
					    {
							header : '名称',
							dataIndex : 'fname',
							width : 120,
							renderer : function(value) {
								if (value == "null") {
									return "";
								} else {
									return value;
								}
							}
						},{
							header : '状态',
							dataIndex : 'fstate',
							width : 120,
							renderer : function(value) {
								if (value == "1") {
									return "已上传模板文件";
								} else {
									return "<font color=red>未上传模板文件</font>";
								}
							}
						}, {
							header : '备注',
							dataIndex : 'fdesc',
							width : 380,
							renderer : function(value) {
									if (value == "null") {
										return "";
									} else {
										return value;
									}
								}
						} ]);
				
					//生成表格
					var grid_mould = new top.Ext.grid.GridPanel({
						closable : false,
						region : 'center',
						height : 350,
						autoWidth : true,
						cm : colM_mould,
						ds : ds_mould,
						sm : sm_mould,
						enableHdMenu : false
					});
					
					var btn_sure_select = new top.Ext.Button({
						text : '确定',
						iconCls : 'sy-sure',
						handler : function() {
							var record = grid_mould.getSelectionModel().getSelected();
							if (record) {
								top.Ext.Msg.confirm('确认更新', '您确定为<font color=red>'+fname_report+'</font>栏目更新模板吗？', function(btn) {
									if (btn == 'yes') {
										Ext.Ajax.request({
											url : 'mouldInfo!updateReportMouldInfo.do',
											params:{
							    	        	"fbh_mould" : record.data.fbh,
							    	        	"fbh_report" : fbh_report
								    	    },
											success : function() {
												add_column_window.close();
												Ext.MessageBox.alert('提示', '更新成功！');
											},
											failure : function() {
												Ext.Msg.show({
													title : '错误提示',
													msg : '更新失败！',
													buttons : Ext.Msg.OK,
													icon : Ext.Msg.ERROR
												});
											}
										});
									}
								});
							} else {
								Ext.MessageBox.alert('提示', '请选择一行纪录进行操作！');
								return;
							}
						}
					});
					
					var btn_cancel_select = new top.Ext.Button({
						text : '取消',
						iconCls : 'sy-cancel',
						handler : function() {
							add_column_window.close();
						}
					});
							
					var add_column_window = new top.Ext.Window(
					{
						width : 700,
						height : 350,
						layout : 'fit', 
						title : '选择更新模板',
						iconCls : 'sy-win-flag',
						modal : true,
						tbar : [ btn_sure_select, '-', btn_cancel_select ],
						items : [ grid_mould ]
					});
					add_column_window.show();

				} // end fun()					
				
				
				
				
				
function mould_set_fun(fbh_report) {
	
		var Jthtwb_mould = top.Ext.data.Record.create([ {
						name : 'fid',
						mapping : 'fid',
						type : 'string'
					}, {
						name : 'fname',
						mapping : 'fname',
						type : 'string'
					}, {
						name : 'fdesc',
						mapping : 'fdesc',
						type : 'string'
					}, {
						name : 'ftext',
						mapping : 'ftext',
						type : 'string'
					}, {
						name : 'fbh',
						mapping : 'fbh',
						type : 'string'
					},{
						name : 'ftype',
						mapping : 'ftype',
						type : 'string'
					}]);
				
					var ds_mould = new top.Ext.data.Store({
						reader : new Ext.data.JsonReader({
							totalProperty : 'totalProperty',
							root : 'root'
						}, Jthtwb_mould),
						idProperty : 'threadid',
						remoteSort : true,
						url : 'mouldInfo!queryMouldInfoText.do'
					});
				
					ds_mould.load({
						params : {
							"fbh_report" : fbh_report
						}
					});
					
				//参数列表
				var view_ds = new top.Ext.data.Store({
					reader : new top.Ext.data.JsonReader({
						totalProperty : 'totalProperty',
						root : 'root'
					}, Jthtwb_mould),
					idProperty : 'threadid',
					remoteSort : true,
					url: 'reportInfo!queryParameterInfo.do'
				});
				
					//定义勾选框，不需要可不必定义
					var sm_mould = new top.Ext.grid.CheckboxSelectionModel({
						singleSelect : true
					});
				
					//定义列
					var colM_mould = new top.Ext.grid.ColumnModel([ sm_mould, new Ext.grid.RowNumberer(),//增加自动编号，不需要可不必定义
					    {
							header : '名称',
							dataIndex : 'ftext',
							width : 180,
							renderer : function(value) {
								if (value == "null") {
									return "";
								} else {
									return value;
								}
							}
						} ]);
				
					//生成表格
					var grid_mould = new top.Ext.grid.GridPanel({
						closable : false,
						region : 'center',
						height : 350,
						autoWidth : true,
						cm : colM_mould,
						ds : ds_mould,
						sm : sm_mould,
						enableHdMenu : false
					});
	
		
		var Tree_op = top.Ext.tree;
		var loader_op = new Tree_op.TreeLoader({
			dataUrl : 'reportInfo!findReportChartTree.do'
		});
		loader_op.on("beforeload", function(treeLoader, node) {
			loader_op.baseParams.fflag = "99";//图表类型树
			//loader.baseParams.fcode  = node.attributes.fcode;
		}, this);

		loader_op.processResponse = function(response, node, callback) {
			var json1 = response.responseText;
			try {
				var json = eval("(" + json1 + ")");
				node.beginUpdate();
				//从json中取得json数组
				var o = json["key"];
				for ( var i = 0, len = o.length; i < len; i++) {
					var n = this.createNode(o[i]);
					if (n) {
						node.appendChild(n);
					}
				}
				node.endUpdate();
				if (typeof callback == "function") {
					callback(this, node);
				}
			} catch (e) {
				this.handleFailure(response);
			}
		};

		var tree_op = new Tree_op.TreePanel({
			region:'center',
            split: true,
			id : 'west-panel',
			//el : 'west-div',
			height : 230,
			useArrows : true,
			minSize: 100,
            autoScroll: true,
			animate : true,
			enableDD : true,
			containerScroll : true,
			rootVisible : false, //树根不可见
			loader : loader_op
		});

		//单击事件
		tree_op.on('click', function(node) {
			top.Ext.get("fbh_id").dom.value = node.id;
			if (node.isLeaf()) { //是图表
				if (node.isLeaf()) { //是报表
					view_ds.removeAll();
					view_ds.load({
						params : {
							'fbh' : node.id
						}
					});
				}
			}
		}, tree_op);

		// set the root node
		var root_op = new Tree_op.AsyncTreeNode({
			text : '所有图表',
			draggable : false,
			id : '0',
			fbh : '-1',
			ftype : '1'
		});
		tree_op.setRootNode(root_op);
		root_op.expand();
		
		var type_combox = new top.Ext.form.ComboBox({
			id : 'type_id',
			name : 'type_id',
			mode : 'local',
			fieldLabel : '图表类型',
			valueField : 'type_id',
			hideValue : 'type_id',
			
			displayField : 'type_name',
			triggerAction : 'all',
			width : 120,
			listeners : {
				select:function(){
					loader_op.on("beforeload", function(treeLoader, node) {
						loader_op.baseParams.fflag = this.value;//图表类型树
					}, this);
					tree_op.root.reload();
				}
			},
			store : new Ext.data.SimpleStore( {
				fields : [ 'type_id', 'type_name' ],
				data : [ [ 1, '报表' ], [ 99, '图表' ]] })
		});  
		
		var btn_sure_template = new top.Ext.Button({
			text : '确定',
			iconCls : 'sy-sure',
			handler : function() {
				var typeStr = top.Ext.get("type_id").dom.value;
				
				if(typeStr == null || typeStr == "" || typeStr == "报表") {
					typeStr = "1";
				} else {
					typeStr = "2";
				}
				var record_mould = grid_mould.getSelectionModel().getSelected();
				//日工作量统计图
			  	Ext.Ajax.request({
			  		url : 'reportInfo!produceTemplateSet.do',
					method : 'POST',
					params : {
						"p_fbh" : fbh_report,
						"fbh" : top.Ext.get("fbh_id").dom.value,
						"fwidth" : top.Ext.get("fwidth_id").dom.value,
						"fheight" : top.Ext.get("fheight_id").dom.value,
						"div_id" : record_mould.data.ftext,
						"ftype" : typeStr
					},
					success : function(response, action) {
						//document.getElementById(obj.id).innerHTML = "<font color=blue>设置成功</font>";
					  	template_choose_window.close();
					},
					// 提交失败的回调函数
					failure : function() {
						top.Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');
					}
				});
			}
		});
		
		var btn_cancel_template = new top.Ext.Button({
			text : '取消',
			iconCls : 'sy-cancel',
			handler : function() {
				template_choose_window.close();
			}
		});
		
		var firstTbar = new top.Ext.Toolbar({
			items:[ '宽度:', {
				xtype : 'numberfield',
				name : 'ffontsize',
				id : 'fwidth_id',
				maxLength : 4,
				minLength : 2,
				value : 400,
				width : 80
			  }, '-', '高度:', {
					xtype : 'numberfield',
					name : 'ffontsize',
					id : 'fheight_id',
					maxLength : 4,
					minLength : 2,
					value : 300,
					width : 80
				  } ] 
			});
		
		var grid_text = new top.Ext.Panel({
			title : '模板设置区域列表',
			region : 'west',
			split : true,
			layoutConfig:{
	            animate:true
	        },
			width : 240,
			layout : 'fit',
			autoScroll : false,
			collapsible : true,
			items : [ grid_mould ]
		});	
 		
		
		
		/*************************************
		 * 
		 * 
		 ************************************/
		
		
		
		//定义勾选框，不需要可不必定义
		var view_sm = new top.Ext.grid.CheckboxSelectionModel({
			singleSelect : false //单选
		});

		//参数类型
		var fcolType_store = new top.Ext.data.SimpleStore( {
				fields : [ 'ftype', 'ftype_desc' ],
				data : [ [ 1, '文本' ], [ 2, '数字' ], [ 3, '日期' ] ]});
		
		//定义列
		var view_colM = new top.Ext.grid.ColumnModel([ view_sm, new top.Ext.grid.RowNumberer(),//增加自动编号，不需要可不必定义
		{
			header : '参数名',
			dataIndex : 'fname',
			width : 120,
			renderer : function(value, metadata, record, rowIndex, colIndex, store) {
				if(value == null || value == "null") {
            		value = "";
            	} else {
            		return value;
            	}
            }
		}, {
			header : '默认值',
			dataIndex : 'fvalue',
			width : 120,
			renderer : function(value, metadata, record, rowIndex, colIndex, store) {
				if(value == null || value == "null") {
            		value = "";
            	} else {
            		return value;
            	}
            } ,
			editor: new top.Ext.form.TextField({
               allowBlank: true,
               style: 'text-align:left'
            }),
			sortable : true
		}, {
			header : '参数描述',
			dataIndex : 'fdesc',
			width : 180,
			renderer : function(value, metadata, record, rowIndex, colIndex, store) {
            	if(value == null || value == "null") {
            		value = "";
            	} else {
            		return value;
            	}
            	
            } 
		}  ]);
		
		var btn_save_parameter = new top.Ext.Button({
		text : '保存',
		iconCls : 'sy-sure',
		handler : function() {
			var view_record = view_grid.getSelectionModel().getSelected();
			if (view_record) {
				var array = view_sm.getSelections();
				
				var idData = ""; 
				var nameData = "";
				var descData = "";
				var typeData = "";
				
				top.Ext.each(array, function(view_record) {
					idData += view_record.get("fid") + ",";
					nameData += view_record.get("fname") + ",";
					descData += view_record.get("fdesc") + ",";
					typeData += view_record.get("ftype") + ",";
				});
				
				if (idData.length == 0) {
					idData = ""; 
					nameData = "";
					descData = "";
					typeData = "";
				} else {
					idData = idData.substring(0,
							idData.length - 1);
					nameData = nameData.substring(0,
							nameData.length - 1);
					descData = descData.substring(0,
							descData.length - 1);
					typeData = typeData.substring(0,
							typeData.length - 1);
				}

				//提交
				top.Ext.Ajax.request({
					url : 'reportInfo!saveReportParameters.do',// ?id='+uid,
					method : 'POST',
					params : {
						"idData" : idData,
						"nameData" : nameData,
						"descData" : descData,
						"typeData" : typeData,
						"fbh" : top.Ext.get("fbh_id").dom.value
					},
					success : function(response, action) {
						//Ext.MessageBox.alert('提示', '操作成功！');
						view_ds.removeAll();
						view_ds.reload();
					},
					// 提交失败的回调函数
					failure : function() {
						top.Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');
					}
				});

			} else {
				top.Ext.MessageBox.alert('提示', '请选择一行或多行纪录进行操作！');
				return;
			}
		}
	});
	
	//生成表格
	var view_grid = new top.Ext.grid.EditorGridPanel({
		//closable : false,
		//region : 'center',
		height : 400,
		id : 'view_grid',
		layout : 'fit',
		width : 347,
		cm : view_colM,
		ds : view_ds,
		sm : view_sm,
		stripeRows : true,
		clicksToEdit:1,
		//defaults:{margins:'20 20 20 20'},
		enableHdMenu : false,
		tbar:[ '<b>设置参数默认值:</b>', btn_save_parameter ]
	});
	// 单元格编辑后事件处理 
    view_grid.on("afteredit", afterEdit, view_grid); 
    // 事件处理函数 
    function afterEdit(e) { 
        
    }; 
		
		
		
		
		var design_rightPanel = new top.Ext.Panel({
	    	region: "center",
			layout:'fit',
			border : true,
			//title : fbh,
		    //collapsible : true,
			split:true,
			height: 100,
            minSize: 100,
			autoScroll: true,
			margins:'0 0 0 0',
			tbar : [ '单元类型:', type_combox, '-', btn_sure_template, '-', btn_cancel_template, {
					xtype : 'hidden',
					name : 'fbh',
					id : 'fbh_id'
				} ],
				listeners : {
					'render' : function(){
						firstTbar.render(this.tbar); 
					}
			 	},
			items : [tree_op]
		});
		
		var detailsPanel1 = {
	        region: 'south',
	        bodyStyle: 'padding-bottom:15px;background:#eee;',
			autoScroll: true,
			layout:'fit',
			height : 180,
			split:true,
			items : [view_grid]
	    };
    
		var template_choose_window = new top.Ext.Window({
			width : 750,
			height : 500,
			title : '设置模板单元',
			iconCls : 'sy-win-flag',
			modal : true,
			layout : 'border',
			items : [ grid_text, {
				layout: 'border',
		        region:'center',
		        border: false,
		        split:true,
				margins: '0 0 0 0',
				items: [design_rightPanel, detailsPanel1]
			} ]
		});
		template_choose_window.show();
			//document.getElementById("tt").innerHTML = "esponseText";
	}